package com.heima.behavior.controller.v1;

import com.heima.behavior.service.*;
import com.heima.model.behavior.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(value = "行为服务API")
@RestController
@RequestMapping("/api/v1")
public class BehaviorController {
    @Autowired
    private ApLikesBehaviorService apLikesBehaviorService;

    @Autowired
    private ApReadBehaviorService apReadBehaviorService;

    @Autowired
    private ApUnlikeBehaviorService apUnlikeBehaviorService;

    @Autowired
    private ApCollectionBehaviorService apCollectionBehaviorService;

    @Autowired
    private ApArticleBehaviorService apArticleBehaviorService;
    @ApiOperation("点赞 或 取消点赞")
    @PostMapping("/likes_behavior")
    private ResponseResult like(@RequestBody @Validated LikesBehaviorDTO dto){
        return apLikesBehaviorService.like(dto);
    }
    @ApiOperation("阅读行为")
    @PostMapping("/read_behavior")
    private ResponseResult read(@RequestBody @Validated ReadBehaviorDTO dto){
        return apReadBehaviorService.readBehavior(dto);
    }
    @ApiOperation("不喜欢 或 取消不喜欢")
    @PostMapping("/un_likes_behavior")
    private ResponseResult unLike(@RequestBody @Validated UnLikesBehaviorDTO dto){
        return apUnlikeBehaviorService.unlikeBehavior(dto);
    }
    @ApiOperation("收藏 或 取消收藏")
    @PostMapping("/collection_behavior")
    private ResponseResult collectBehavior(@RequestBody @Validated CollectionBehaviorDTO dto){
        return apCollectionBehaviorService.collectBehavior(dto);
    }
    @ApiOperation("查询文章行为")
    @PostMapping("/article/load_article_behavior")
    private ResponseResult loadArticleBehavior(@RequestBody @Validated ArticleBehaviorDTO dto){
        return apArticleBehaviorService.loadArticleBehavior(dto);
    }
}
